﻿//-----------------------------------------------------------------------
// <copyright file="ChatDataResult.cs" company="AFS">
// Copyright (c) AFS. All rights reserved.
//
//    This file is part of Chatbox.
//
//    Chatbox is free software: you can redistribute it and/or modify
//    it under the terms of the GNU Lesser General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    any later version.
//
//    Chatbox is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//    GNU Lesser General Public License for more details.
//
//    You should have received a copy of the GNU Lesser General Public License
//    along with Chatbox. If not, see http://www.gnu.org/copyleft/lesser.html
// </copyright>
//----------------------------------------------------------------------- 

namespace ChatBox.DomainObjects.ResultData
{
    using System;
    using System.Collections.Generic;

    using DomainObjects.XmlFeedObjects;

    /// <summary>
    /// delegate type for recieving message data
    /// </summary>
    /// <param name="data">The data received</param>
    public delegate void ChatDataResultHandler(ChatDataResult data);

    /// <summary>
    /// Result of an operation that reads public messages
    /// </summary>
    public class ChatDataResult : OperationResult
    {
        /// <summary>
        /// Initializes a new instance of the ChatDataResult class with an exception
        /// </summary>
        /// <param name="success">the success flag</param>
        /// <param name="error">the exception</param>
        public ChatDataResult(bool success, Exception error)
        {
            this.Success = success;
            this.Error = error;
        }

        /// <summary>
        /// Initializes a new instance of the ChatDataResult class with a message
        /// </summary>
        /// <param name="success">the success flag</param>
        /// <param name="message">the error message</param>
        public ChatDataResult(bool success, string message)
        {
            this.Success = success;
            this.Message = message;
        }

        /// <summary>
        /// Gets or sets the type of data returned, interfaces or messages
        /// </summary>
        public ServerDataType ServerDataType { get; set; }

        /// <summary>
        /// Gets or sets the room id name name
        /// </summary>
        public Link Room { get; set; }

        /// <summary>
        /// Gets or sets the topic text
        /// </summary>
        public string Topic { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the topic has changed
        /// </summary>
        public bool TopicChanged { get; set; }

        /// <summary>
        /// Gets or sets the messages in the room
        /// </summary>
        public IEnumerable<Message> Messages { get; set; }

        /// <summary>
        /// Gets or sets the list of e2 xml interfaces
        /// </summary>
        public IEnumerable<XmlInterface> Interfaces { get; set; }
    }
}